package cn.bdqn.service.impl;

import cn.bdqn.domain.Doctor;
import cn.bdqn.mapper.DoctorMapper;
import cn.bdqn.service.DoctorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


@Service("DoctorService")
public class DoctorServiceImpl implements DoctorService {

    @Autowired
    private DoctorMapper doctorMapper;

    /**
     *删除医生信息
     * @param id 医生id主键
     * @return  是否成功
      */
    @Override
    public int takeOffByid(Integer id) {return doctorMapper.deleteByPrimaryKey(id);}

    /**
     *添加医生全部信息
     * @param record 医生信息
     * @return 是否成功
     */
    @Override
    public int addDoctorInformation(Doctor record) {return doctorMapper.insert(record); }

    /**
     * 添加医生部分信息
     * @param record 医生信息
     * @return 是否成功
     */
    @Override
    public int addSelective(Doctor record) { return doctorMapper.insertSelective(record); }

    /**
     *根据id查询医生信息
     * @param id 医生id主键
     * @return 查询的医生信息
     */
    @Override
    public Doctor queryDoctorInformation(Integer id) {return doctorMapper.selectByPrimaryKey(id); }

    /**
     *修改医生全部信息
     * @param record 待修改的医生信息
     * @return 是否成功
     */
    @Override
    public int changeDoctorInformationByidSelective(Doctor record) {return doctorMapper.updateByPrimaryKey(record); }

    /**
     * 修改医生部分信息
     * @param record 待修改的医生信息
     * @return 是否成功
     */
    @Override
    public int changeDoctorInformationById(Doctor record) { return doctorMapper.updateByPrimaryKeySelective(record); }
}
